# -*- coding: utf-8 -*-
# @Time    : 2021/8/30 22:55
# @Author  : BrandonGT
# @FileName: 04_PyQt5_QWidget_控件交互.py

import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *

class Window(QWidget):
    def __init__(self):
        super().__init__()  # 初始化继承的父类内部的__init__
        self.setWindowTitle("[Let me Try]交互状态的学习")
        self.resize(300, 300)
        self.setWindowModified(True)
        self.setup_ui()

    def setup_ui(self):
        btn = QPushButton(self)
        btn.resize(100, 50)
        btn.setText("按钮")
        btn.clicked.connect(lambda : print("按钮被点击"))
        btn.setEnabled(False)
        
    def paintEvent(self, QPaintEvent):
        print("窗口被绘制了")
        return super(Window, self).paintEvent(QPaintEvent)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = Window()
    # window.show()
    window.setVisible(True)
    sys.exit(app.exec_())